package com.ygqh.baby.model;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.ygqh.baby.ao.AppType;
import com.ygqh.baby.ao.OrderType;
import com.ygqh.baby.ao.PayType;
import org.apache.commons.lang.StringUtils;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author Ss
 */
public class CommitOrderRequestParam extends BaseRequestParam {

	private String platformNo;
	
	private Long userAddressId;

	private Long couponDetailId;

	private PayType payType;

	private AppType appType;

	private BigDecimal totalPrice;

	private String sourceCode;

	private BigDecimal accountPrice;

	private String userRemark;

	private Long expressCardId;

	private OrderType orderType;

	private String formId;

	private String skuInfos;

	private Long groupId;

	private Long groupBuyId;

	private List<BaseSkuInfo> skuList;

	private String identityNo;

	private String recordCode;

	private Long giftSkuId;

	private Boolean distribution = false;

	private String linkCode;

	public Boolean getDistribution() {
		return distribution;
	}

	public void setDistribution(Boolean distribution) {
		this.distribution = distribution;
	}

	public String getPlatformNo() {
		return platformNo;
	}

	public void setPlatformNo(String platformNo) {
		this.platformNo = platformNo;
	}

	public Long getUserAddressId() {
		return userAddressId;
	}

	public void setUserAddressId(Long userAddressId) {
		this.userAddressId = userAddressId;
	}

	public Long getCouponDetailId() {
		return couponDetailId;
	}

	public void setCouponDetailId(Long couponDetailId) {
		this.couponDetailId = couponDetailId;
	}

	public PayType getPayType() {
		return payType;
	}

	public void setPayType(PayType payType) {
		this.payType = payType;
	}

	public AppType getAppType() {
		return appType;
	}

	public void setAppType(AppType appType) {
		this.appType = appType;
	}

	public BigDecimal getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(BigDecimal totalPrice) {
		this.totalPrice = totalPrice;
	}

	public String getSourceCode() {
		return sourceCode;
	}

	public void setSourceCode(String sourceCode) {
		if (StringUtils.isBlank(sourceCode) || sourceCode.equals("undefined")) {
			this.sourceCode = null;
		} else {
			this.sourceCode = sourceCode;
		}
	}

	public BigDecimal getAccountPrice() {
		return accountPrice;
	}

	public void setAccountPrice(BigDecimal accountPrice) {
		this.accountPrice = accountPrice;
	}

	public String getUserRemark() {
		return userRemark;
	}

	public void setUserRemark(String userRemark) {
		this.userRemark = userRemark;
	}

	public Long getExpressCardId() {
		return expressCardId;
	}

	public void setExpressCardId(Long expressCardId) {
		this.expressCardId = expressCardId;
	}

	public OrderType getOrderType() {
		return orderType;
	}

	public void setOrderType(OrderType orderType) {
		this.orderType = orderType;
	}

	public String getFormId() {
		return formId;
	}

	public void setFormId(String formId) {
		this.formId = formId;
	}

	public String getSkuInfos() {
		return skuInfos;
	}

	public Long getGroupId() {
		return groupId;
	}

	public void setGroupId(Long groupId) {
		this.groupId = groupId;
	}

	public Long getGroupBuyId() {
		return groupBuyId;
	}

	public void setGroupBuyId(Long groupBuyId) {
		this.groupBuyId = groupBuyId;
	}

	public void setSkuInfos(String skuInfos) {
		this.skuInfos = skuInfos;
		if (StringUtils.isNotBlank(skuInfos)) {
			try {
				this.skuList = JSON.parseObject(skuInfos, new TypeReference<List<BaseSkuInfo>>() {
				});
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public List<BaseSkuInfo> getSkuList() {
		return skuList;
	}

	public void setSkuList(List<BaseSkuInfo> skuList) {
		this.skuList = skuList;
	}

	public String getIdentityNo() {
		return identityNo;
	}

	public void setIdentityNo(String identityNo) {
		this.identityNo = identityNo;
	}

	public String getRecordCode() {
		return recordCode;
	}

	public void setRecordCode(String recordCode) {
		this.recordCode = recordCode;
	}

	public Long getGiftSkuId() {
		return giftSkuId;
	}

	public void setGiftSkuId(Long giftSkuId) {
		this.giftSkuId = giftSkuId;
	}

	public String getLinkCode() {
		return linkCode;
	}

	public void setLinkCode(String linkCode) {
		this.linkCode = linkCode;
	}

	@Override
	public String toString() {
		return "CommitOrderRequestParam{" +
				"platformNo='" + platformNo + '\'' +
				", userAddressId=" + userAddressId +
				", couponDetailId=" + couponDetailId +
				", payType=" + payType +
				", appType=" + appType +
				", totalPrice=" + totalPrice +
				", sourceCode='" + sourceCode + '\'' +
				", accountPrice=" + accountPrice +
				", userRemark='" + userRemark + '\'' +
				", expressCardId=" + expressCardId +
				", orderType=" + orderType +
				", formId='" + formId + '\'' +
				", skuInfos='" + skuInfos + '\'' +
				", groupId=" + groupId +
				", groupBuyId=" + groupBuyId +
				", skuList=" + skuList +
				", identityNo='" + identityNo + '\'' +
				", recordCode='" + recordCode + '\'' +
				", giftSkuId='" + giftSkuId + '\'' +
				", linkCode='" + linkCode + '\'' +
				'}';
	}
}
